// index.js
// 获取应用实例
let api = require('../../utils/api.js');
let resultData = require('../../utils/data.js');
Page({
  data: {
    bannerData: [],
    subJectData:[],
  },
 
  onLoad() {
    this.setData({
      bannerData: resultData.bannerData,
      subJectData: resultData.subJectData
    })
   this.getBannerData()
  },

getBannerData:function() {
  api.getData('/onebox/movie/pmovie', 'get', {
    key: 'a8b932b7661aee98fcb3c89984626302',
    city: '杭州'
  }).then(res => {
    console.log(res)
  }, err => {
    console.log(err)
  });
},

  // 设置swiper自适应图片宽高  swiper上加bindload="imgLoad"
  imgLoad(e) {
    console.log(e.detail);
    // 获取屏幕宽度
    var winWidth = wx.getSystemInfoSync().windowWidth
    // 获取图片宽度
    var imgWidth = e.detail.width
    // 获取图片高度
    var imgHeight = e.detail.height
    this.setData({
      swiperHeight:winWidth*imgHeight/imgWidth + 'px'
    })
  },



})
